//
//  ReactiveBaseModel.m
//  Version1.0_RectiveCocoa
//
//  Created by 吴可高 on 2018/1/11.
//  Copyright © 2018年 吴可高. All rights reserved.
//

#import "ReactiveBaseModel.h"
#import <ReactiveObjC/RACReturnSignal.h>

@interface ReactiveBaseModel()
@property(nonatomic,strong) NSString *indefiner;
@end

@implementation ReactiveBaseModel

-(void)bindingData{
    RACSubject * object =[RACSubject subject];
    [object sendNext:@""];
    [object sendCompleted];
    RAC(self,self.indefiner) =  RACObserve(self, self.indefiner);
    RACCommand * command = [[RACCommand alloc]initWithSignalBlock:^RACSignal * _Nonnull(id  _Nullable input) {
        return [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
            [subscriber sendNext:@""];
            [subscriber sendCompleted];
            return nil;
        }];
    }];
    [command execute:nil];
    [[[[RACCommand alloc]init]execute:nil]subscribeNext:^(id  _Nullable x) {
        
    } error:^(NSError * _Nullable error) {
        
    }];
    [[RACObserve(self, self.indefiner)map:^id _Nullable(id  _Nullable value) {
        return  [RACReturnSignal return:[NSString stringWithFormat:@"%@",value]];
    }]subscribeNext:^(id  _Nullable x) {
        
    }];
    
    [RACObserve(self, self.indefiner) subscribeNext:^(id  _Nullable x) {
    } error:^(NSError * _Nullable error) {
        
    }];
}
@end
